﻿@model Orion.Models.QuestionViewModel

<script src="@Url.Content("~/Scripts/Pagination/jquery.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/Pagination/jquery.pagination.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/Pagination/jquery.pag.js")" type="text/javascript"></script>


<div id="Searchresult"></div>


@{
    var sk = 0;
    for( int m = 0; m < Model.counter; m++ )
    {
    <div id="hiddenresult" style="display:none;">
        <div class="result">

    <table>
        <caption></caption>        
        <thead>
            <tr>
                <th>Dagsetning</th>
                <th>Titill</th>
                <th>Innihald</th>
                <th>Viðtakandi</th>
            </tr>
        </thead>
        <tbody>

        @foreach( var item in Model.Questions.Skip(sk).Take( Model.displayQuestions ) )
        {
        DateTime temp = item.QuestionDate.Value;
        <tr>
            @if( item.Status == "Nýtt")
            {
                    <td><b>@temp.ToString("dd MMMM yyyy")</b></td>
                    <td class ="shortenMeQuestion"><b>@Html.ActionLink( item.Title, "SendMail/"+@item.ID, "Questions" )</b></td>
                    <td class ="shortenMeQuestion"><b>@item.Question1</b></td>
                    <td class ="shortenMeQuestion"><b>@item.Recipient</b></td>
                    <td><b>@Html.ActionLink("Svara", "SendMail/" + item.ID, "Questions")</b></td>
            }
            @if( item.Status =="Í vinnslu")
            {
                    <td>@temp.ToString("dd MMMM yyyy")</td>
                    <td class ="shortenMeQuestion">@Html.ActionLink(item.Title, "SendMail/" + @item.ID, "Questions")</td>
                    <td class ="shortenMeQuestion">@item.Question1</td>
                    <td class ="shortenMeQuestion">@item.Recipient</td>
                    <td><b>@Html.ActionLink("Svara", "SendMail/" + item.ID, "Questions")</b></td>
            }
                @if (item.Status == "Sent")
                {
                    <td><i>@temp.ToString("dd MMMM yyyy")</i></td>
                    <td class ="shortenMeQuestion"><i>@Html.ActionLink(item.Title, "ShowAnswer/" + item.ID,"Quistions")</i></td>
                    <td class ="shortenMeQuestion"><i>@item.Question1</i></td>
                    <td class ="shortenMeQuestion"><i>@item.Recipient</i></td>
                    <td><b>@Html.ActionLink("Skoða Svar", "GetQuestionById/" + item.ID, "Questions")</b></td>
                }
        </tr>
        }
            </tbody>
        </table>
        </div>
    </div>
    sk = sk + Model.displayQuestions;
    }
}   <div id="Pagination"></div>
